package com.rcloud.server.sealtalk.controller;


import com.rcloud.server.sealtalk.controller.param.FaceAuthParam;
import com.rcloud.server.sealtalk.exception.ServiceException;
import com.rcloud.server.sealtalk.manager.FaceAuthManager;
import com.rcloud.server.sealtalk.model.response.APIResult;
import com.rcloud.server.sealtalk.model.response.APIResultWrap;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;


/**
 * 百度人脸识别认证
 */
@Api(tags = "百度人脸识别认证")
@Slf4j
@RestController
@RequestMapping("/baidu/face")
@AllArgsConstructor
public class BaiduFaceAuthController extends BaseController {

    private FaceAuthManager faceAuthManager;
    /**
     * 人脸识别认证
     */
    @PostMapping(value = "/faceAuth")
    @ApiOperation(value = "百度人脸识别认证", notes = "百度人脸识别认证")
    public APIResult<Object> faceAuth(@Valid @RequestBody FaceAuthParam param) throws ServiceException {
        Boolean result = faceAuthManager.faceAuthHandle(param,getCurrentUserId(),2);
        return APIResultWrap.ok(result);
    }
}